package Chap06;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
//实现查询学生成绩的最大值，最小值，平均数 返回学生的个人信息
public  class StuApp {
    public static void main(String[] args) {
        //新建五个学生对象
        Student stu1=new Student("1001","soojin","男",18,86);
        Student stu2=new Student("1002","sunmi","男",17,66);
        Student stu3=new Student("1003","tom","男",18,43);
        Student stu4=new Student("1004","lily","女",14,68);
        Student stu5=new Student("1005","bob","女",21,99);
        //放入集合
        List <Student>list=new<Student> ArrayList();
        Collections.addAll(list,stu1,stu2,stu3,stu4,stu5);
        //遍历
        System.out.println("学生信息如下:");
        list.forEach(student -> System.out.println(student));
        //输出最大值，最小值和平均数
        Tools tools=new Tools();
        System.out.println("java成绩最高分的同学信息如下:\n"+tools.getMax(list));
        System.out.println("java成绩最低分的同学信息如下:\n"+tools.getMin(list));
        System.out.println("java成绩高于60分，低于80分的同学信息如下:");
        List Area=tools.getArea(list);
        Area.forEach(s-> System.out.println(s));
        System.out.println("学生java成绩平均分为:"+tools.getAvg(list));

    }
}